import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import actions from './actions'
import getters from './getters'
import mutations from './mutations'
import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)

const store = new Vuex.Store({
    state,
    actions,
    getters,
    mutations,
    plugins: [createPersistedState(
        {
            storage: window.sessionStorage,
            reducer(val) {
                return {
                    // 只储存state中的user
                    // userInfo: val.userInfo,
                    VehicleData: val.VehicleData,
                    ImgUrl:val.ImgUrl,
                    count:val.count,
                    footercolor:val.footercolor
                }
            }
        }
    )],
})
export default store